//
//  UIImage+Utility.h
//  DGUtilityKit
//
//  Created by Jinxiao on 4/11/13.
//  Copyright (c) 2013 debugeek. All rights reserved.
//

@interface UIImage (Stretch)
+ (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size;
- (UIImage *)stretchableImageWithCapInsets:(UIEdgeInsets)capInsets;
- (UIImage *)stretchableImageByCenter;
- (UIImage *)stretchableImageByHeightCenter;
- (UIImage *)stretchableImageByWidthCenter;
+ (UIImage *)stretchImageWithName:(NSString *)name;
@property (nonatomic, readonly) NSInteger rightCapWidth;
@property (nonatomic, readonly) NSInteger bottomCapHeight;


/**
 *  在一张背景图上绘制文字并且居中
 *
 *  @param str       要绘制到图片上的文字
 *  @param image     背景图片
 *  @param fontSize  文字的大小
 *  @param textColor 文字颜色
 *
 *  @return 绘制上文字的图片
 */
+ (UIImage *)createOtherMerchantImage:(NSString *)str withBgImage:(UIImage *)image withFont:(CGFloat)fontSize withTextColor:(UIColor *)textColor;

@end

@interface UIImage (OrientationFix)

- (UIImage *)orientationFixedImage;

- (UIImage *)imageByScalingWithScale:(double)scale;

@end

@interface UIImage (Color)

+ (UIImage *)imageWithColor:(UIColor *)color;

@end

@interface UIImage (Gradient)

+ (UIImage *)verticalGradientImageBySize:(CGSize)size topColor:(UIColor *)topColor bottomColor:(UIColor *)bottomColor;

@end

@interface UIImage (Resize)

- (UIImage *)clippedImageByConstranedSize:(CGSize)constranedSize;
- (UIImage *)resizedImageByConstranedSize:(CGSize)constranedSize;
- (UIImage *)resizedImage:(CGSize)newSize interpolationQuality:(CGInterpolationQuality)quality;
- (UIImage *)orientationFixedImage;

@end
